<waitfor> : Wait For (Window, Clipboard, Key, Mouse, Web Page)

Wait for a special event (window, clipboard, key, mouse) to occur. 

Syntax: 

<waitfor>("Object", "Event", "Param",  TimeOut, Exact)

Object
Can be one of these:
"WIN" - a window related event is expected
"CLIP" - a clipboard related event is expected
"KEY" - a specific key press is expected
"MOUSE"  - a mouse click is expected

Event
These events are supported for particular Object:
"WIN" :
   - "OPEN" - wait until the window specified by Param is opened.
   - "CLOSE" - wait until the window specified by Param is closed.
   - "ACT" - wait until the window specified by Param is activated.
   - "NOACT" - wait until the window specified by Param is deactivated.
"CLIP" : 
   - "EMPTY" - wait until the clipboard is emptied.
   - "SET" - wait until some data are put into the clipboard.
"KEY" :
   - "" (key is pressed) - wait until some of the keys specified by  Param is pressed.
"MOUSE" :
   - "" (mouse click) - wait until mouse click specified by  Param appears.

Param
Has this meaning depending on the Object:
"WIN" - window title
"CLIP" - not used
"KEY" - can be one or more keys.  For example, if Param is "abc<F6><alt>" the <waitfor> waits until either a or b or c or F6 or Alt key is pressed.
"MOUSE" - can be one of these:
   <mlbu> - left mouse button
   <mmbu> - middle mouse button
   <mrbu> - right mouse button

TimeOut
Timeout in seconds.  If 0, the <waitfor> never timeouts.  If the command timeouts then _vErr system variable is set.  This allows to handle such a case in the macro code.

Exact
Used only for "WIN" Object.  If 1, the window title must exactly match the Param.  If 0,  the Param can be a substring of a window title.

Example: 

<#> This macro shows how to use 'waitfor' command
<#>
<cmds>
<msg>(100,100,"Press 'Ctrl' key to continue this macro.","Message",0)
<waitfor>("KEY","","<ctrl>",5,0)
<msgoff>
<msg>(100,100,"Press left mouse button to continue this macro.","Message",0)
<waitfor>("MOUSE","","<mlbu>",5,0)
<msgoff>
<msg>(100,100,"Macro is finished.","Message",1)